import {
  call, put, all, takeLatest,
} from 'redux-saga/effects'
import { global as globalDuck, auth0 as auth0Duck } from 'ducks'
import { SERVER_ADDRESS } from 'env'

function* show(action) {
  console.log('=======&&&&&&&&&====log in start')
  yield call(action.value.show.bind(action.value))
  console.log('=======&&&&&&&&&====log in end')
}

function* logout(action) {
  yield call(action.value.logout.bind(action.value), {
    returnTo: SERVER_ADDRESS,
  })
}

export default function* sagas() {
  yield all([takeLatest(auth0Duck.types.SHOW, show), takeLatest(auth0Duck.types.LOGOUT, logout)])
}
